package com.ll.blog.contant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

import java.util.Objects;

@Getter
public enum ArticleStatusEnum{
    NO_RELESED(0,"未发布"),
    RELEASED(1,"已发布"),
    ;
    @EnumValue
    private Integer value;
    @JsonValue
    private String desc;

    ArticleStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    public static ArticleStatusEnum codeToEnum(Integer i){
        ArticleStatusEnum[] values = values();
        for (ArticleStatusEnum value : values) {
            if (Objects.equals(value.value, i)){
                return value;
            }
        }
        return null;
    }
}
